package com.fucius.study.leetcode;

public class CheckRecord {

    public boolean checkRecord(String s) {

        int aCount = 0;
        int lCount = 0;

        for (int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);
            if ('A'== c) {
                aCount ++;
            }
            if ('L'== c) {
                lCount ++;
            }else{
                lCount = 0;
            }
            if (aCount>=2 || lCount >= 3) {
                return false;
            }
        }
        return true;
    }

    public static void main(String[] args) {
        System.out.println(new CheckRecord().checkRecord("PALLPLLPPPLLL"));
    }
}
